﻿namespace Example
{
    using System.Data.Linq;
    using System.Linq;
    using Example.Models;
    using Example.Properties;
    using Xunit;

    public sealed class Linq2SqlFacts
    {
        [Fact]
        public void select_from_table()
        {
#if DEBUG
            var db = new DataContext(Settings.Default.Northwind);

            var query = from customer in db.GetTable<NorthwindCustomer>()
                        where "London" == customer.City
                        select customer;

            Assert.Equal(6, query.Count());
#endif
        }

        [Fact]
        public void select_from_table_hirarchy()
        {
#if DEBUG
            var db = new DataContext(Settings.Default.Northwind);

            var query = from customer in db.GetTable<NorthwindCustomer>()
                        where "London" == customer.City
                        select customer;

            Assert.Equal(6, query.Count());
#endif
        }
    }
}